<!DOCTYPE html>
<html>
<head>
	<title>文章列表</title>
	<meta charset="utf-8">
	<link rel="stylesheet" type="text/css" href="../bower_components/bootstrap/dist/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="../styles/main.css">
	<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
	<script type="text/javascript" src="../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="../scripts/main.js"></script>
</head>
<body>
	<div class="admin_top">
		<ul class="list-inline pull-right">
			<li>欢迎 <%=username%></li>
			<li><a class="exit" href="admin/outlogin">退出</a></li>
		</ul>
	</div>
	<div class=" admin_body"></div>
	<div class="container">
	<%if(success!=""){%>
		<div class="alert alert-success alert-dismissible"  role="alert">
			<button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
		<%=success%>
		</div>   
	<%}%>
		<div class="rows">
			<div class="col-md-12">
				<nav aria-label="Page navigation">
					<ul class="pagination">
						<li>
							<a href="<%if(currentpage!=1){%>?page=<%=currentpage-1%><%}%>">
								<span>&laquo;</span>
							</a>
						</li>
						<%for(var i=1;i<=totolpage;i++){%>
						<li <% if(currentpage==i){%> class="active"<%}%>><a href="?page=<%=i%>"><%=i%></a></li>
						<%}%>
						<li>
							<a href="<%if(currentpage!=totolpage){%>?page=<%=(parseInt(currentpage)+1)%><%}%>">
								<span>&raquo;</span>
							</a>
						</li>
					</ul>
				</nav>
				<div class="page-header">
					文章列表
					<a class="btn btn-success btn-xs pull-right" href="/admin/addArticle">新增文章</a>
				</div>
				<table class="table">
					<tr>
						<th>ID</th>
						<th>标题</th>
						<th>内容</th>
						<th>图片</th>
						<th width="80">分类</th>
						<th width="50">编辑</th>
					</tr>
					<% for(var i=0;i<articles.length;i++){%>
					<tr>
						<td><%=articles[i].aid%></td>
						<td><%=articles[i].title%></td>
						<td width="400"><%-articles[i].content%></td>
						<td><img width="100" src="/<%=articles[i].img%>"></td>
						<td><%=articles[i].name%></td>
						<td>
							<a class="btn btn-info btn-xs" href="/admin/editArticle?id=<%=articles[i].aid %>">编辑</a><br/>
							<a class="btn btn-danger btn-xs" href="/admin/del?id=<%=articles[i].aid %>">删除</a>
						</td>
					</tr>
					<%}%>
				</table>
			</div>
		</div>
		<nav aria-label="Page navigation">
			<ul class="pagination">
				<li>
					<a href="<%if(currentpage!=1){%>?page=<%=currentpage-1%><%}%>">
						<span>&laquo;</span>
					</a>
				</li>
				<%for(var i=1;i<=totolpage;i++){%>
				<li <% if(currentpage==i){%> class="active"<%}%>><a href="?page=<%=i%>"><%=i%></a></li>
				<%}%>
				<li>
					<a href="<%if(currentpage!=totolpage){%>?page=<%=(parseInt(currentpage)+1)%><%}%>">
						<span>&raquo;</span>
					</a>
				</li>
			</ul>
		</nav>
	</div>
</body>
</html>
<script type="text/javascript">
	setTimeout(function(){
			$('.alert').fadeOut(3000);
		},3000)
	// $.get("/admin/text",function(res,status){
	// 	alert(res)
	// });
</script>
